<p class="Paragraph"><help:paragraphinfo state="U" number="2" xmlns:help="http://openoffice.org/2000/help"/>You can apply user-defined functions in <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Calc in the following ways:</p>
<ul class="L1">
<li class="">
<p class="P2"><help:paragraphinfo state="U" number="3" xmlns:help="http://openoffice.org/2000/help"/>In the <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Help you will find information about programming the functions as <help:link Id="66872" xmlns:help="http://openoffice.org/2000/help">add-ins</help:link>. This method requires advanced knowledge of programming.</p>
</li>
<li class="">
<p class="P2"><help:paragraphinfo state="U" number="4" xmlns:help="http://openoffice.org/2000/help"/>Using the Basic-IDE, even without advanced knowledge of programming, you can define your own functions.</p>
</li>
</ul>
<p class="Paragraph"><help:paragraphinfo state="U" number="5" xmlns:help="http://openoffice.org/2000/help"/>In this example we define a VOL(a; b; c) function which calculates the volume of a rectangular solid with side lengths a, b and c.</p>
<p class="Head2"><help:paragraphinfo state="U" number="6" xmlns:help="http://openoffice.org/2000/help"/>Defining Your Own Functions in Basic IDE</p>
<p class="P3"><help:paragraphinfo state="U" number="8" xmlns:help="http://openoffice.org/2000/help"/>Click the <span class="T1">Edit</span> button. You will now see the Basic IDE.</p>
</li>
<li class="">
<p class="P3"><help:paragraphinfo state="U" number="9" xmlns:help="http://openoffice.org/2000/help"/>Enter the function, as displayed in the illustration.</p>
</li>
<li class="">
<p class="P3"><help:paragraphinfo state="U" number="10" xmlns:help="http://openoffice.org/2000/help"/>Close the Basic-IDE window.</p>
<p class="P3"><help:paragraphinfo state="U" number="11" xmlns:help="http://openoffice.org/2000/help"/>Your function is automatically saved in the default module and is now available in your <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname>. If you apply the function in a Calc document that is to be used on another computer, you can copy the function to the Calc document. You will find the instructions in the following section.</p>
</li>
</ol>
<p class="Head2"><help:paragraphinfo state="U" number="18" xmlns:help="http://openoffice.org/2000/help"/>Copying user-defined functions to a document</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="19" xmlns:help="http://openoffice.org/2000/help"/>In stage 2 of "Defining a user-defined function in Basic-IDE", in the <span class="T1">Macro</span> dialog you clicked on <span class="T1">Edit </span>. As the default, in the <span class="T1">Macro from</span> field the <span class="T1">soffice - Default - Module1</span> module is selected. The default module resides locally in your user directory.</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="20" xmlns:help="http://openoffice.org/2000/help"/>If you want to copy the user-defined function to a Calc document:</p>
<p class="P4"><help:paragraphinfo state="U" number="22" xmlns:help="http://openoffice.org/2000/help"/>In the <span class="T1">Macro from</span> field select <span class="T1">soffice - Default - Module1</span>. Click <span class="T1">Edit</span>.</p>
</li>
<li class="">
<p class="P4"><help:paragraphinfo state="U" number="23" xmlns:help="http://openoffice.org/2000/help"/>In the Basic-IDE, select the source of your user-defined function and copy it to the clipboard. Close the Basic-IDE.</p>
<p class="P4"><help:paragraphinfo state="U" number="25" xmlns:help="http://openoffice.org/2000/help"/>In the <span class="T1">Macro from</span> field select <span class="T1">(Name of the Calc document)- Default - Module1</span>. Click <span class="T1">Edit</span>.</p>
</li>
<li class="">
<p class="P4"><help:paragraphinfo state="U" number="26" xmlns:help="http://openoffice.org/2000/help"/>Paste the clipboard contents in the Basic-IDE of the document.</p>
</li>
</ol>
<p class="Head2"><help:paragraphinfo state="U" number="12" xmlns:help="http://openoffice.org/2000/help"/>Applying a user-defined function in <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Calc</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="13" xmlns:help="http://openoffice.org/2000/help"/>Once you have defined the function VOL(a; b; c) in the Basic-IDE, you can apply it in exactly the same way as the built-in functions of <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Calc.</p>
<ol class="L4">
<li class="">
<p class="P5"><help:paragraphinfo state="U" number="14" xmlns:help="http://openoffice.org/2000/help"/>Open a <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Calc document and enter a few numbers in columns A, B and C, for example.</p>
</li>
<li class="">
<p class="P5"><help:paragraphinfo state="U" number="15" xmlns:help="http://openoffice.org/2000/help"/>Set the cursor in cell D1 and enter the following:</p>
<p class="P5"><help:paragraphinfo state="U" number="17" xmlns:help="http://openoffice.org/2000/help"/>The function is evaluated and you will see the result in cell D1.</p>
<p class="ParaList"><help:paragraphinfo state="U" number="27" xmlns:help="http://openoffice.org/2000/help"/>Switch to "Help about <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Basic", then search for "Integrated Development Environment (IDE)".</p>